<template>
  <div>
    <!-- <h3>用户组:</h3> -->
    <span>用户组: {{ groupname }}</span>

    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="feature_name" label="视图名"> </el-table-column>
      <el-table-column
        prop="create_time"
        label="创建时间"
        :formatter="create_time"
      >
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="{ row, $index }">
          <el-button type="danger" size="mini" @click="remove(row, $index)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <div style="float: right; margin: 20px; padding-right: 50px">
      <el-button type="primary" @click="add()">添加权限</el-button>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      dialogVisible: false,
      dialogData: {},
      tableData: [],
      groupname: "",
    };
  },
  created() {
    this.query();
    this.groupname = this.$route.query.groupname;
  },
  methods: {
    query() {
      let k = this;
      axios({
        method: "post",
        url: "/group/detail",
        dataType: "json",
        data: { groupname: k.$route.query.groupname },
      }).then(function (rsp) {
        console.log(rsp.data);
        if (rsp.data.msg == "success") {
          k.tableData = rsp.data.data;
        } else {
          k.$message.error("查询错误：" + rsp.data.msg);
        }
      });
    },
    create_time(row, column) {
      var date = new Date(row.create_time); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
      var Y = date.getFullYear() + "-";
      var M =
        (date.getMonth() + 1 < 10
          ? "0" + (date.getMonth() + 1)
          : date.getMonth() + 1) + "-";
      var D = date.getDate() + " ";
      var h = date.getHours() + ":";
      var m = date.getMinutes() + ":";
      var s = date.getSeconds();
      return Y + M + D + h + m + s;
    },
  },
};
</script>
